function openWindow(url, width, height, scroll){  
  var  y=((window.screen.availHeight-height)/2);  
  var  x=((window.screen.availWidth-width)/2);  
  if(x<0)
  	x=0;
  if(y<100)
  	y=0;
  else
  	y=y-100;

  var w = window.open(url, "", "height=" + height + ",width=" + width + ",fullscreen=no,channelmode=no,directories =no,toolbar=no,menubar=no,scrollbars=" + scroll + ", resizable=yes,location=no,status=no,top=" + y + ",left=" + x + "");
	return w;
}

function openWin(url, width, height, scroll){
  if(width==null)
  	width = 1003;
  if(height==null)
  	height = window.screen.availHeight;
  if(scroll==null)
  	scroll = 'yes';
  var w = openWindow(url, width, height, scroll);
  w.focus();
}

/*function $(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++){
      elements.push($(arguments[i]));
	}
    return elements;
  }
  if (typeof element == 'string')
    element = document.getElementById(element);
  return element;
}*/

function fPopUpCalendarDlg(ctrlobj)
{
	showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
	showy = event.screenY - event.offsetY + 18; // + deltaY;
	newWINwidth = 210 + 4 + 18;

	retval = window.showModalDialog("/admin/CalendarDlg.htm", "", "dialogWidth:210px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
	if( retval != null ){
		ctrlobj.value = retval;
	}else{
		//alert("canceled");
	}
}

function fPopUpImpSummaryDlg(ctrlobj)
{
	showx = event.screenX - event.offsetX - 4 - 310 ; // + deltaX;
	showy = event.screenY - event.offsetY + 18; // + deltaY;
	newWINwidth = 310 + 4 + 18;

	retval = window.showModalDialog("/ggs/noticeSelSummary.jsp", "", "dialogWidth:"+newWINwidth+"px; dialogHeight:260px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:yes;Resizable=no; "  );
	if( retval != null ){
		ctrlobj.value = retval;
	}else{
		//alert("canceled");
	}
}

function dropdownMenu(el){
	var e = $(el);
	var os_l = e.offset().left;
	var os_t = e.offset().top+20;
	var isOpen = e.parent().hasClass('open');
	if(isOpen==true){
		e.parent().children('.dropdown-menu').css({
			left:'-120px'
		})
	}else{
		e.parent().children('.dropdown-menu').css({
			left:os_l,
			top:os_t
		})
	}
	e.parent().toggleClass('open');
}
